
package com.carsite.service.impl;

import java.util.List;

import com.carsite.service.impl.BaseManager;
import com.carsite.model.OrderNo;
import com.carsite.dao.OrderNoDao;
import com.carsite.service.OrderNoManager;

public class OrderNoManagerImpl extends BaseManager implements OrderNoManager {
    private OrderNoDao dao;

    /**
     * Set the Dao for communication with the data layer.
     * @param dao
     */
    public void setOrderNoDao(OrderNoDao dao) {
        this.dao = dao;
    }

    /**
     * @see com.carsite.service.OrderNoManager#getOrderNos(com.carsite.model.OrderNo)
     */
    public List getOrderNos(final OrderNo orderNo) {
        return dao.getOrderNos(orderNo);
    }

    /**
     * @see com.carsite.service.OrderNoManager#getOrderNo(String id)
     */
    public OrderNo getOrderNo(final String id) {
        return dao.getOrderNo(new Long(id));
    }

    /**
     * @see com.carsite.service.OrderNoManager#saveOrderNo(OrderNo orderNo)
     */
    public void saveOrderNo(OrderNo orderNo) {
        dao.saveOrderNo(orderNo);
    }

    /**
     * @see com.carsite.service.OrderNoManager#removeOrderNo(String id)
     */
    public void removeOrderNo(final String id) {
        dao.removeOrderNo(new Long(id));
    }

	public OrderNo getOrderNO() {
		// TODO Auto-generated method stub
		List list=dao.getOrderNos(null);
		OrderNo orderNo;
		if(null==list||list.size()==0){
			return null;
		}else{
			orderNo=(OrderNo)list.get(0);
		}
		//orderNo.setNum(orderNo.getNum()+1);
		//dao.saveOrderNo(orderNo);
		return orderNo;
	}
    
    
}
